/*************************************************************************
> File Name: 02_test_arr.cpp
> Author: hzy
> Created Time: 2023-08-10 11:46:58
> Description: 用于数组的 new 和 delete
************************************************************************/
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

using namespace std;

class Demo
{
public:
    Demo()
    {
        cout << "Demo()" << endl;
    }
    Demo(int myval)
    {
        cout << "Demo(int myval)" << endl;
        val = myval;
    }
    ~Demo()
    {
        cout << "~Demo()" << endl;
    }

    void show()
    {
        cout << "val = " << val << endl;
    }

private:
    int val;
};

int main()
{
    Demo *arr = new Demo[5];
    // Demo *arr = new Demo[5]{1, 2, 3, 4, 5};

    delete[] arr;

    return 0;
}